<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>文章列表</title>
  <link rel="stylesheet" href="/static/css/font.css">
  <link rel="stylesheet" href="/static/css/index.css">
  <script src="/static/lib/layui/layui.js" charset="utf-8"></script>
  <script type="text/javascript" src="/static/js/index.js"></script>
</head>
<body>
<div class="x-nav">
  <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
    <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md12">
      <div class="layui-card">
        <div class="layui-card-body ">
          <button class="layui-btn"  lay-submit="" lay-filter="sreach" type="submit" onclick="haveRead()"><i class="layui-icon">已读</i></button>
          <button class="layui-btn"  lay-submit="" lay-filter="sreach" type="submit" onclick="noRead()"><i class="layui-icon">未读</i></button>
          <button class="layui-btn"  lay-submit="" lay-filter="sreach" type="submit" onclick="allFeedback()"><i class="layui-icon">所有</i></button>
        </div>
        <div class="layui-card-body layui-table-body layui-table-main">
          <table class="layui-table layui-form" align="center">
            <thead >
            <tr>
              <th>ID</th>
              <th>标题</th>
              <th>作者</th>
              <th>内容</th>
              <th>发布时间</th>
              <th>状态</th>
              <th>操作</th></tr>
            </thead>
            <tbody >
            <tr  th:each="list,listStat:${feedbackList}">
              <td th:text="${listStat.index+1}"></td>
              <td th:text="${list.feedbackTitle}" style="max-width: 100px;overflow: hidden; text-overflow:ellipsis;white-space: nowrap"></td>
              <td th:text="${list.userInfo.userName}"></td>
              <td th:text="${list.feedbackContent}" style="max-width: 100px;overflow: hidden; text-overflow:ellipsis;white-space: nowrap"></td>
              <td th:text="${list.feedbackTime}"></td>
              <td class="td-status">
                <span class="layui-btn layui-btn-normal layui-btn-mini"  th:if="${list.feedbackStatus} == 0">未读</span>
                <span class="layui-btn layui-btn-danger layui-btn-mini"  th:if="${list.feedbackStatus} == 1">已读</span></td>
              <td class="td-manage">
                <a title="查看" th:onclick="member_update(this,[[${list.feedbackId}]])" href="javascript:;">
                  <button class="layui-btn layui-btn-normal layui-btn-mini" style="padding-top: 5px"><svg t="1662515179976" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5144" width="20" height="20"><path d="M956 624.752C847.632 771.248 689.056 863.872 512 863.872 334.96 863.872 176.384 771.248 68 624.752 20.144 560.08 20.144 463.952 68 399.264 176.384 252.768 334.96 160.144 512 160.144 689.056 160.144 847.632 252.768 956 399.264 1003.856 463.952 1003.856 560.08 956 624.752ZM907.872 452.384C807.344 307.328 662.656 224.144 510.912 224.144 359.168 224.144 214.48 307.328 113.952 452.384 90 486.944 90 537.104 113.952 571.664 214.48 716.72 359.168 799.92 510.912 799.92 662.656 799.92 807.344 716.72 907.872 571.648 931.824 537.104 931.824 486.944 907.872 452.384ZM512.32 735.824C388.608 735.824 288.32 635.536 288.32 511.824 288.32 388.112 388.608 287.824 512.32 287.824 636.032 287.824 736.32 388.112 736.32 511.824 736.32 635.536 636.032 735.824 512.32 735.824ZM512.32 351.824C423.952 351.824 352.32 423.456 352.32 511.824 352.32 600.192 423.952 671.824 512.32 671.824 600.688 671.824 672.32 600.192 672.32 511.824 672.32 423.456 600.688 351.824 512.32 351.824Z" p-id="5145" fill="#ffffff"></path></svg></button>
                </a>
                <a title="删除" th:onclick="member_del(this,[[${list.feedbackId}]])" href="javascript:;">
                  <button class="layui-btn layui-btn-danger layui-btn-mini"><i class="layui-icon">&#xe640;</i></button>
                </a>
              </td>
            </tr>

            </tbody>
          </table>
        </div>
        <!--<div class="layui-card-body ">
          <div class="page">
            <div>
              <a class="prev" href="">&lt;&lt;</a>
              <a class="num" href="">1</a>
              <span class="current">2</span>
              <a class="num" href="">3</a>
              <a class="num" href="">489</a>
              <a class="next" href="">&gt;&gt;</a>
            </div>
          </div>
        </div>-->
      </div>
    </div>
  </div>
</div>
</body>
<script  th:inline="javascript">
  layui.use(['laydate','form'], function(){
    var laydate = layui.laydate;
    var  form = layui.form;

    //执行一个laydate实例
    laydate.render({
      elem: '#start' //指定元素
    });

    //执行一个laydate实例
    laydate.render({
      elem: '#end' //指定元素
    });


  });
  /*用户-删除*/
  function member_del(obj,id){
    layer.confirm('确认要删除吗？',function(index){
      $.ajax({
        url:'updateFeedbackStatus',
        method:'post',
        async:false,
        data:{'feedbackId':id,'feedbackStatus':2},
        success:function (data) {
          res=data;
        }
      });
      if (res=="1"){
        //发异步删除数据
        $(obj).parents("tr").remove();
        layer.msg('已删除!',{icon:1,time:1000});
      }else {
        window.location.href="toErrorPage"
      }
    });
  }
  /*用户-修改*/
  function member_update(obj,id){
    $.ajax({
      url:'updateFeedbackStatus',
      method:'post',
      async:false,
      data:{'feedbackId':id,'feedbackStatus':1},
    });
    xadmin.open('查看','lookFeedback')
  }
  function haveRead() {
    window.location.href='findHaveReadCustomerFeedback'
  }
  function noRead() {
    window.location.href='findNoReadCustomerFeedback'
  }
  function allFeedback() {
    window.location.href='findAllCustomerFeedback'
  }
</script>
</html>